<?php
require_once('../config/auth.php');
require_once('guard.cl.php');
$__CURRENT_PAGE__ = 'affect_garde';
$__TITLE__ = "Formulaire d'affecter une garde";
$guard = new Guard();
$message = '';
if(count($_POST) > 0 ) {
  $guardData = $guard->save($_POST);
    if(!$guard->hasError()) {
        $message = "<div class='alert alert-success'>Garde sauvegardés avec succès</div>";
    }
}
elseif(!empty($_GET['id'])) {
    $guard->loadGuardById($_GET['id']);
}
require_once(dirname(__FILE__).'/../config/head.php');?>
<body>  
<?php require_once(dirname(__FILE__).'/../config/menu.php'); ?>
<div class="container">
 <h1>Gestion des gardes</h1>
 <?php echo $message ?>
<form method="post">
 	<input type="hidden" name="employe_id" value="<?php echo $guard->getId() ?>" />
<div class="row"> 
  <div class="span4">
    <?php echo $guard->getError('guard_unit_id') ?>
    <label>Id unité de garde:</label>
    <input type="text" id="guard_unit_id" name="guard_unit_id" size="50" maxlength="50" value="<?php echo $guard->getGuardUnitId() ?>">
  </div>  
  <div class="span4">  
    <?php echo $guard->getError('employeMatricule') ?>
    <label>Matricule de l'employe :</label>
    <input type="text" name="employeMatricule"  id="employeMatricule" size="50" maxlength="50" value="<?php echo $guard->getEmployeMatricule() ?>">
  </div>
</div>

<div class="row">
  <div class="span2">
      <input type="reset" value="Annuler" class="btn btn-large btn-block">
  </div>
  <div class="span2 offset3">
      <input type="submit" value="Valider" class="btn btn-success btn-large btn-block">
  </div>
</div>

</form>
</div> 
</body>
